function ensure_dir(dirname)
% Make sure the directory exists. Always call this function for the output
% folder. It will create all necessary folders. 
%
%LICENSE: BSD
%Author: Alexander Sorokin,syrnick@gmail.com



if ~exist(dirname,'dir')
    mkdir(dirname);
end

